<div class="grid-24">
  <?php if (Yii::app()->user->hasFlash('success')): ?>
    <div class="notify notify-success">
      <a href="javascript:;" class="close">×</a>
      <?php echo Yii::app()->user->getFlash('success'); ?>
    </div>
  <?php endif; ?>

  <?php
  $this->renderPartial('_search', array(
      'model' => $searchModel,
      'searchData' => $searchData,
      'siteList' => $siteList,
      'adStatus' => $adStatus,
      'gridStatus' => $gridStatus,
      'statusList' => $statusList,
  ));
  ?>

  <div class="widget widget-table">
    <div class="widget-header">
      <span class="icon-list"></span>
      <h3 class="icon chart"><?php echo Yii::t('main', 'category.list_title'); ?></h3>

    </div>

    <div class="widget-content">
      <div class="dataTables_wrapper">
        <div class="fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix">
          <div class="dataTables_filter">
          <?php $extend =  (isset($searchData['member_id'])) ? '?memberId/' . $searchData['member_id'] : ''?>
            <a href="<?php echo Yii::app()->createUrl('admin/accounts/create'. $extend); ?>" >
              <button class="btn btn-small btn-success">
                <span class="icon-plus"></span><?php echo Yii::t('main', 'button.add'); ?>
              </button>
            </a>
          </div>
        </div>

        <table class="table table-bordered table-striped">
          <thead>
            <tr>
              <th class="ui-state-default" width="6%">
                <?php echo CHtml::link(Yii::t('main', 'header.stt'), 'javascript:void(0)', array('class' => 'float_left')); ?>
              </th>
              <th class="ui-state-default" width="10%">
                <?php echo "Name"; ?>
              </th>
              <th class="ui-state-default">
                <?php echo "Member"; ?>
              </th>
              <th class="ui-state-default" width="10%">
                <?php echo "Site"; ?>
              </th>
              <th class="ui-state-default" width="8%">
                <?php echo "Status"; ?>
              </th>
              <th class="ui-state-default" width="8%">
                <?php echo "A Status"; ?>
              </th>
              <th class="ui-state-default" width="10%">
                <?php echo "G Status"; ?>
              </th>
              <th class="ui-state-default" width="10%">
                <?php echo "$ Current"; ?>
              </th>
              <th class="ui-state-default" width="10%">
                <?php echo "$ Total"; ?>
              </th>
              <th class="ui-state-default" width="10%">
                <?php echo "Mac add"; ?>
              </th>
              <th class="ui-state-default" width="14%">
              </th>
            </tr>
          </thead>
          <tbody>
            <?php $i = 1; ?>
            <?php foreach ($models as $model): ?>
              <tr class="gradeA">
                <td><?php echo $i + (Yii::app()->request->getQuery('page', 1) - 1) * $pages->getPageSize(); ?></td>
                <td><?php echo CHtml::encode($model->name); ?></td>
                <td class="center"><?php echo CHtml::encode($model->member_id); ?></td>
                <td class="text_center"><?php echo $siteList[$model->site_id]; ?></td>
                <td class="text_center"><?php echo $statusList[$model->status]; ?></td>
                <td class="text_center"><?php echo $adStatus[$model->ad_status]; ?></td>
                <td class="text_center"><?php echo $gridStatus[$model->grid_status]; ?></td>
                <td class="text_center"><?php echo $model->money_current; ?></td>
                <td class="text_center"><?php echo $model->money_total; ?></td>
                <td class="text_center"><?php echo $model->mac_address; ?></td>
                <td class="text_center">
                  <a href="<?php echo Yii::app()->createUrl('admin/accounts/update', array('id' => $model->account_id) + $_GET); ?>">
                    <button class="btn btn-small btn-warning">
                      <span class="icon-pen"></span><?php echo Yii::t('main', 'button.edit'); ?>
                    </button>
                  </a>
                  <button class="btn btn-small btn-error" type="button" onclick="return accountPage.remove('<?php echo Yii::app()->createUrl('admin/account/delete', array('id' => $model->account_id)); ?>')">
                    <span class="icon-minus"></span><?php echo Yii::t('main', 'button.delete'); ?>
                  </button>
                </td>
              </tr>
              <?php $i++; ?>
            <?php endforeach; ?>
          </tbody>
        </table>
        <?php $this->renderPartial('../units/_pager', array('pages' => $pages, 'countData' => count($models))); ?>
      </div>
    </div>
    <!-- .widget-content -->

  </div>
  <!-- .widget -->

</div>

<?php
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile(Yii::app()->baseUrl . '/js/accounts.js');
?>